<%@ page language="java" import="java.util.*,com.dao.*,com.beans.UserInfo" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
  <head>
    <base href="<%=basePath%>">
    <title></title>
    <link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
    <link rel="stylesheet" href="css/poposlides.css">
    <link rel="stylesheet" href="css/layout.css">
    <script src="js/jquery-2.1.4.min.js"></script>
  </head>
  
  <body>
   <div class="skin-main">
        <div class="frame-aside">
            <ul>
                <li><a href="HdfsServlet?flag=manage"  target="centerFrame" class="active"><img src="images/fileIcons/all.png" />全部文件</a></li>
                <li><a href="HdfsServlet?flag=searchFiles&type=picture" target="centerFrame" ><img src="images/fileIcons/picIcon.png" /> 图片</a></li>
                <li><a href="HdfsServlet?flag=searchFiles&type=txt" target="centerFrame" ><img src="images/fileIcons/wordIcon.png" /> 文档</a></li>
                <li><a href="HdfsServlet?flag=searchFiles&type=avi" target="centerFrame" ><img src="images/fileIcons/aviIcon.png" /> 视频</a></li>
                <li><a href="HdfsServlet?flag=searchFiles&type=torrent" target="centerFrame" ><img src="images/fileIcons/pdfIcon.png" /> 种子</a></li>
                <li><a href="HdfsServlet?flag=searchFiles&type=sound" target="centerFrame" ><img src="images/fileIcons/soundIcon.png" /> 音乐</a></li>
                <li><a href="HdfsServlet?flag=searchFiles&type=gz" target="centerFrame" ><img src="images/fileIcons/zipIcon.png" /> 压缩</a></li>
                <li><a href="HdfsServlet?flag=manage" target="centerFrame" ><img src="images/fileIcons/sourceCodeIcon.png" /> 源码</a></li>
                <li><a href="HdfsServlet?flag=manage" target="centerFrame" ><img src="images/fileIcons/programIcon.png" /> 项目</a></li>
                <li><a href="HdfsServlet?flag=manage" target="centerFrame" ><img src="images/fileIcons/txtIcon.png" /> 资源</a></li>
                <li>
	                <div class="aside-absolute">
	                    <div class="remaining">
	                    	<div class="remainingSpace"></div>
	                    </div>
	                    <div class="font">
	                          <%
	                        	//HdfsHADao dao=new HdfsHADao();
	                        	HdfsDao dao=new HdfsDao();
	                        	UserInfo user=(UserInfo)session.getAttribute("g_user");
	                        	float size=dao.getUserDiskSize(user.getUserName());
	                        	
	                        	String sizeStr="";
	                        	
				                if(size>=1099511627776L){
									sizeStr= String.format("%.2f", size/1024/1024/1024/1024)+" P";
								}
								else if(size>=1073741824){
									sizeStr= String.format("%.2f", size/1024/1024/1024)+" G";
								}
								else if(size>=1048576){
									sizeStr= String.format("%.2f", size/1024/1024)+" M";
								}
								else if(size>1024)   {		
									sizeStr= String.format("%.2f", size/1024)+" K";
								}
								else{
									sizeStr= size+ " Byte"; 
								}
				                        	
	                        	double percent = size/(1024*1024*1024);
				   			    String percentStr=	String.format("%.2f",percent*100);
				    
	                        	request.setAttribute("sizeStr", sizeStr);
	                        	request.setAttribute("percentStr", percentStr);
	                         %>
	                        <span>${sizeStr} / 1 G</span>   
	                    </div>
	                    <div  class="layout-absolute">
	                        <img src="images/icon4.png">
	                        <img src="images/icon5.png">
	                        <img src="images/icon6.png">
	                        <img src="images/icon7.png">
	                    </div>
	                </div>
                </li>

            </ul>

        </div>
        

       </div>
       
       <script>
       	  $(".remainingSpace").css("width","${percentStr}%");
       </script>
       
    
  </body>
</html>
